<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="box">
        {{a | toDou b c}}<br>
        具体数值
        <input type="text" v-model="a"><br>
        <br>
        前缀
        <input type="text" v-model="b"><br>
        <br>
        保留小数位
        <input type="text" v-model="c"><br>
    </div>
    <script>
        Vue.filter('toDou',function(val,b,c){
            var temp = '';

            c>0?temp='.':temp='';

            for(i = 0; i<c; i++){
                temp = temp + '0';
            }

            return val<10?b+'0'+val+temp:b+''+val+temp;
        });
        var vm=new Vue({
            data:{
                a:9,
                b:"",
                c:""
            }
        }).$mount('#box');

    </script>
</body>
</html>



















